home *** CD-ROM | disk | FTP | other *** search
/ Freelog 101 / FreelogNo101-JanvierFevrier2011.iso / Multimedia / MediaCope / MediaCopeSetup.exe / {app} / extensions / Speak Text / content / overlay.js < prev   
Text File  |  2009-11-02  |  2KB  |  56 lines

  1. var speaktext = {
  2.   onLoad: function() {
  3.  
  4.   this.initialized = true;
  5.   document.getElementById("contentAreaContextMenu")
  6.           .addEventListener("popupshowing", function(e) { speaktext.showContextMenu(e); }, false);
  7.   },
  8.  
  9.   showContextMenu: function(event) {
  10.  
  11.     document.getElementById("context-speaktext0").hidden = !gContextMenu.isTextSelected;
  12.   },
  13.  
  14.   onMenuItemCommand: function(e, i) {
  15.  
  16.  
  17.    var file = Components.classes["@mozilla.org/file/local;1"]
  18.                         .createInstance(Components.interfaces.nsILocalFile);
  19.  
  20.    file.initWithPath("C:\\Speak Text.exe");
  21.  
  22.    var process = Components.classes["@mozilla.org/process/util;1"]
  23.                            .createInstance(Components.interfaces.nsIProcess);
  24.    process.init(file);
  25.    
  26.  
  27.    sSelectedText = "No Text Selected";
  28.  
  29.    if(gContextMenu.isTextSelected)
  30.     {
  31.          var focusedWindow = document.commandDispatcher.focusedWindow;
  32.          if (focusedWindow == window) focusedWindow = window._content;
  33.          sSelectedText = focusedWindow.getSelection();     
  34.     }
  35.  
  36.  
  37.    var wrk = Components.classes["@mozilla.org/windows-registry-key;1"]
  38.                        .createInstance(Components.interfaces.nsIWindowsRegKey);
  39.    wrk.create(wrk.ROOT_KEY_CURRENT_USER, "Software\\Microsoft\\Internet Explorer\\LowRegistry\\Media Cope\\Media Cope\\Speak Text\\", wrk.ACCESS_WRITE);
  40.  
  41.    wrk.writeStringValue("", sSelectedText);
  42.  
  43.    wrk.close();  
  44.  
  45.  
  46.    var args = ["0", i];
  47.  
  48.    process.run(false, args, args.length);
  49.  
  50.  
  51.   },
  52.  
  53. };
  54.  
  55. window.addEventListener("load", function(e) { speaktext.onLoad(e); }, false);
  56.